package com.it.chapter03;

import android.os.Bundle;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.it.chapter03.utils.Utils;

public class TextBorderActivity extends AppCompatActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_text_border);
        TextView tv = findViewById(R.id.tv_code);
        System.out.println("运行到了");
        // 获取布局参数
        ViewGroup.LayoutParams params = tv.getLayoutParams();
        // 设置元素的值(一般不这么做) -> 需要把dp数值转换成px数值
        params.width = Utils.dip2px(this, 300);
        tv.setLayoutParams(params);
    }
}